package zhy.UseViewGroupCustomPullHeader;

import android.app.Activity;
import android.os.Bundle;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.ListView;

public class UseViewGroupCustomPullHeaderActivity extends Activity {

	ViewGroupPull2 group;
	ListView list;int listFirstVisibleItem=0;
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        /*
        ViewGroup group=new ViewGroupPull(this);
        group.setBackgroundColor(Color.BLUE);
        setContentView(group);
        */
        
        /*
        setContentView(R.layout.main);
        */
        
        setContentView(R.layout.main2);
        group=(ViewGroupPull2)findViewById(R.id.group);
        list=(ListView)findViewById(R.id.list);
        list.setOnScrollListener(new OnScrollListener(){

			@Override
			public void onScrollStateChanged(AbsListView view, int scrollState) {
				if(scrollState==OnScrollListener.SCROLL_STATE_IDLE&&listFirstVisibleItem==0)
				{
					group.flag=true;
				}
				else
				{
					group.flag=false;
				}
			}

			@Override
			public void onScroll(AbsListView view, int firstVisibleItem,
					int visibleItemCount, int totalItemCount) {
				listFirstVisibleItem=firstVisibleItem;
				
			}});
        
    }
}